/*
 * Saphre - Suffix Arrays for Phrase Extraction
 * Copyright (C) 2013 
 * Dale Gerdemann Tübingen, Germany 
 * Niko Schenk Frankfurt am Main, Germany
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
package collectors.api;

import util.Interval;

/**
 * A Collector interface.
 * A collector is intended to be a used as a visitor in traversing an lcp-interval
 * tree. The lcp-interval tree of a corpus is a structured list of all its n-grams
 * occuring in the corups. 
 * During the traversal, information is gathered for various statistics,
 * such as term frequency, left context and distribution of an n-gram across
 * documents. This information can be used in various ways to rate phrases.
 * 
 * @author Dale Gerdemann, Niko Schenk
 */
public interface PreOrderCollector {

    /**
     * The add(...) method visits non-terminal nodes in an lcp-interval tree.
     * Non-terminal nodes correspond to repeats, i.e. n-grams with tf > 0.
     * 
     * @param inter an lcp-interval in the lcp-interval tree
     * @param parentLcp
     * @param lcp longest common prefix of interval = length of phrase (n-gram)
     * @param depth
     * @return successfully visited ?
     */
    public boolean add(Interval inter, int parentLcp, int lcp, int depth);

    /**
     * The addTrivial(...) method visits terminal nodes in an lcp-interval tree.
     * Terminal nodes correspond to non-repeating n-grams, i.e. with tf = 0.
     * 
     * @param inter a trivial lcp Interval in the lcp-interval tree (terminal node)
     * @param lcp = length of n-gram, lcp == 0 means unigram of tf = 1
     * lcp == 1 means bigram of tf = 1, etc.
     * @param depth 
     */
    public void addTrivial(Interval inter, int lcp, int depth);
}
